﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUL;
using Entity;

namespace PM
{
    public partial class DetailView : System.Web.UI.MasterPage
    {
        PageBul bul=new PageBul();

        protected void Page_Load(object sender, EventArgs e)
        {
            LoadMenu();
           
        }
        public void LoadMenu()
        {
            var list1 = bul.Page_GetByPosition("2", "vi", 5);
            string strMenu = "<ul>";
            foreach (var menu1 in list1)
            {
                strMenu = strMenu + string.Format("<li><a href=\"{0}\">{1}</a>", menu1.Link, menu1.Name);
                var sublist1 = bul.Page_GetByLevel(menu1.Level, "vi", 10);
                if (sublist1.Count > 0)
                {
                    strMenu = strMenu + "<ul>";
                    foreach (var menu2 in sublist1)
                    {
                        strMenu = strMenu + string.Format("<li><a href=\"{0}\">{1}</a></li>", menu2.Link, menu2.Name);
                    }
                    strMenu = strMenu + "</ul>";
                }
                strMenu = strMenu + "</li>";
            }
            strMenu = strMenu + "</ul>";
            ltrUlTop.Text = strMenu;
        }
       
    }
}